<template>
  <div class="app-container">
    <!-- 定义播放器dom -->
    <div id="J_prismPlayer" className="prism-player"/>
  </div>
</template>
<script>
export default {
  /**
   * 页面渲染完成时：此时js脚本已加载，Aliplayer已定义，可以使用
   * 如果在created生命周期函数中使用，Aliplayer is not defined错误
   */
  mounted() {
    var vd = this.$route.params.vid
    var pa = localStorage.getItem("playAuth")
    var player = new Aliplayer(
      {
        id: "J_prismPlayer",
        vid: vd, // 视频id this.vid
        playauth: pa, // 播放凭证 this.playAuth
        encryptType: "1", // 如果播放加密视频，则需设置encryptType=1，非加密视频无需设置此项
        width: "100%",
        height: "500px"
      },
      function(player) {
        console.log("播放器创建成功");
      }
    )
  },
}
</script>
